package com.buercorp.wangyu.file.objectstream;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 *  利用序列化流/对象操作输出流  把文件中的对象读取到程序
 * @author
 */
public class ObjectInputStreamTest {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        // 创建反序列化流
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("filejava/java6.txt"));
        // 读取数据
        Object o = ois.readObject();

        System.out.println(o); // Student{age = 22, name = liyiyu}

        ois.close();
    }
}
